package com.probiz.estore.common.model.order.base;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.order.OrderShipment;
import com.probiz.estore.common.model.order.OrderSku;
import com.probiz.estore.core.model.BaseObject;

/**
 * OrderShipmentItem Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class OrderShipmentItemTbl extends BaseObject implements Serializable {

    protected Integer orderShipmentItemId;
	protected Integer deliveryQuantity;
	protected Integer incomingQuantity;
	protected OrderSku orderSku;
	protected OrderShipment orderShipment;


	/**
	 * Default Empty Constructor for class OrderShipmentItem
	 */
	public OrderShipmentItemTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class OrderShipmentItem
	 */
	public OrderShipmentItemTbl (
		 Integer in_orderShipmentItemId
        ) {
		this.setOrderShipmentItemId(in_orderShipmentItemId);
    }

	
	public OrderSku getOrderSku () {
		return orderSku;
	}	
	
	public void setOrderSku (OrderSku in_orderSku) {
		this.orderSku = in_orderSku;
	}
	
	public OrderShipment getOrderShipment () {
		return orderShipment;
	}	
	
	public void setOrderShipment (OrderShipment in_orderShipment) {
		this.orderShipment = in_orderShipment;
	}
    

	/**
	 * 	 * @return Integer
     * @hibernate.id column="orderShipmentItemId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getOrderShipmentItemId() {
		return this.orderShipmentItemId;
	}
	
	/**
	 * Set the orderShipmentItemId
	 */	
	public void setOrderShipmentItemId(Integer aValue) {
		this.orderShipmentItemId = aValue;
	}	

	/**
	 * 发货单外键	 * @return Integer
	 */
	public Integer getOrderShipmentId() {
		return this.getOrderShipment()==null?null:this.getOrderShipment().getOrderShipmentId();
	}
	
	/**
	 * Set the orderShipmentId
	 */	
	public void setOrderShipmentId(Integer aValue) {
	    if (aValue==null) {
	    	orderShipment = null;
	    } else {
	        orderShipment = new OrderShipment(aValue);
	        orderShipment.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 销售项外键	 * @return Integer
	 */
	public Integer getOrderSkuId() {
		return this.getOrderSku()==null?null:this.getOrderSku().getOrderSkuId();
	}
	
	/**
	 * Set the orderSkuId
	 */	
	public void setOrderSkuId(Integer aValue) {
	    if (aValue==null) {
	    	orderSku = null;
	    } else {
	        orderSku = new OrderSku(aValue);
	        orderSku.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
	    }
	}	

	/**
	 * 发货数量	 * @return Integer
	 * @hibernate.property column="deliveryQuantity" type="java.lang.Integer" length="10" not-null="true" unique="false"
	 */
	public Integer getDeliveryQuantity() {
		return this.deliveryQuantity;
	}
	
	/**
	 * Set the deliveryQuantity
	 * @spring.validator type="required"
	 */	
	public void setDeliveryQuantity(Integer aValue) {
		this.deliveryQuantity = aValue;
	}	
	

	public Integer getIncomingQuantity() {
		return incomingQuantity;
	}

	public void setIncomingQuantity(Integer incomingQuantity) {
		this.incomingQuantity = incomingQuantity;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof OrderShipmentItemTbl)) {
			return false;
		}
		OrderShipmentItemTbl rhs = (OrderShipmentItemTbl) object;
		return new EqualsBuilder()
				.append(this.orderShipmentItemId, rhs.orderShipmentItemId)
				.append(this.getOrderSkuId(), rhs.getOrderSkuId())
				.append(this.deliveryQuantity, rhs.deliveryQuantity)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.orderShipmentItemId) 
								.append(this.deliveryQuantity) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("orderShipmentItemId", this.orderShipmentItemId) 
								.append("deliveryQuantity", this.deliveryQuantity) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "orderShipmentItemId";
	}
	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return orderShipmentItemId;
	}

}